<?php
require_once("checkFr.php");

class test extends PHPUnit_Framework_TestCase
{
	
	public function setUp()
	{
		echo "I run before each test\n";
	}
	
	public function testRegister()
    	{
        $this->assertFileExists('/home/mbaye/Documents/devweb/registerFr.txt');
    	}
    	public function testOnline()
    	{
        $this->assertFileExists('/home/mbaye/Documents/devweb/onlineFr.txt');
    	}
    
    	public function testcheckParam()
    	{
		$param='foo';
        $this->assertFalse(checkParam($param));
    	}
    
    	public function testfileread()
    	{
		$contenu=readfiles();
		$this->assertNotEquals($contenu, 'mbaye%c5ae282905386426559806a');
			
	}
	public function testfilewrite()
    	{
		Online("onlineFr.txt", 'lolaa');
		//on re ouvre le fichier pour tester s'il a bien ecrit ce qu'on voulit qu'il ecrive
			$fp = fopen("onlineFr.txt","r");
			$contenu = fread ($fp, filesize ("onlineFr.txt"));
			fclose ($fp);
			$tableau = explode("\r\n", $contenu);
			 foreach($tableau as $ligne)
			{
				$this->assertNotEquals($ligne, 'lolaa');
			}
	}

    	public function TearDown()
	{
		echo "I run after each test\n";
	}
    
}

?>
